
using Microsoft.EntityFrameworkCore;
using Zhaoxi.Zhihu.Core.QuestionAggregate.Entites;
using Zhaoxi.Zhihu.Core.QuestionAggregate.Specifications;

namespace Zhaoxi.Zhihu.Infrastructure.Repositories;

public class AnswerRepositoy(AppDbContext dbContext) : EfGenericRepository<Answer>(dbContext),IAnswerRepositoy
{
    public async Task<Answer?> GetAnswerByIdWithLikeByUserIdAsync(AnswerByIdWithLikeByUserIdSpec specification, CancellationToken cancellationToken = default)
    {
        return await SpecificationEvaluator.GetQuery(DbSet, specification)
            .FirstOrDefaultAsync(cancellationToken: cancellationToken);
    }
}